﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DelonixRegiaHMSys.Core.Services;
using DelonixRegiaHMSys.Infrastructure.Data;
using DelonixRegiaHMSys.Core.Models;

namespace DelonixRegiaHMSys.UI.WebForms
{
    public partial class AddGuestParticular : System.Web.UI.Page
    {
        string userID;
        protected void Page_Load(object sender, EventArgs e)
        {
            userID = Request.QueryString["UserID"];
        }

        protected void btngpnext_Click(object sender, EventArgs e)
        {
            GuestParticular gp = new GuestParticular();
            gp.GuestID = tbxguestID.Text;
            gp.GuestLastName = tbxguestLastName.Text;
            gp.GuestFirstName = tbxguestFirstName.Text;
            gp.HomeAddress = tbxHomeAddress.Text;
            gp.Nationality = ddlnationality.SelectedValue;
            gp.ContactNum = Convert.ToInt32(tbxcontactNum.Text);
            gp.EmailAddress = tbxemailAddress.Text;
            gp.MailAddress = tbxmailAddress.Text;

            var gpservice = new gpServices(new EfGuestParticularQuery());
            gpservice.AddGuest(gp);

            string queryString = "UserID=" + userID + "&GuestID=" + gp.GuestID;
            Server.Transfer("~/WebForms/RRandCIModule/RoomReservationManagement.aspx?" + queryString);
        }

        protected void btngpback_Click(object sender, EventArgs e)
        {
            Server.Transfer("~/WebForms/SystemAccountModule/MainPage.aspx?UserID=" + userID);
        }
    }
}